summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2022-10-18 19:10:33 +0200
committerLioncash <mathew1800@gmail.com>2022-10-18 22:06:50 +0200
commit2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d (patch)
tree085be908b4a4796b4ff284b3dda59757e1a60ab6
parentfixed_point: Make to_uint() non-const (diff)
downloadyuzu-2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d.tar
yuzu-2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d.tar.gz
yuzu-2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d.tar.bz2
yuzu-2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d.tar.lz
yuzu-2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d.tar.xz
yuzu-2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d.tar.zst
yuzu-2cc9d94060bbf4a6395ea1ebaa06ce65bb8fc07d.zip
-rw-r--r--src/common/fixed_point.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h
index 116dfbb33..cbe76fbf1 100644
--- a/src/common/fixed_point.h
+++ b/src/common/fixed_point.h
@@ -304,11 +304,11 @@ public: // comparison operators
friend constexpr auto operator<=>(FixedPoint lhs, FixedPoint rhs) = default;
public: // unary operators
- constexpr bool operator!() const {
+ [[nodiscard]] constexpr bool operator!() const {
return !data_;
}
- constexpr FixedPoint operator~() const {
+ [[nodiscard]] constexpr FixedPoint operator~() const {
// NOTE(eteran): this will often appear to "just negate" the value
// that is not an error, it is because -x == (~x+1)
// and that "+1" is adding an infinitesimally small fraction to the
@@ -316,11 +316,11 @@ public: // unary operators
return FixedPoint::from_base(~data_);
}
- constexpr FixedPoint operator-() const {
+ [[nodiscard]] constexpr FixedPoint operator-() const {
return FixedPoint::from_base(-data_);
}
- constexpr FixedPoint operator+() const {
+ [[nodiscard]] constexpr FixedPoint operator+() const {
return FixedPoint::from_base(+data_);
}
@@ -406,42 +406,42 @@ public: // conversion to basic types
data_ += (data_ & fractional_mask) >> 1;
}
- constexpr int to_int() {
+ [[nodiscard]] constexpr int to_int() {
round_up();
return static_cast<int>((data_ & integer_mask) >> fractional_bits);
}
- constexpr unsigned int to_uint() {
+ [[nodiscard]] constexpr unsigned int to_uint() {
round_up();
return static_cast<unsigned int>((data_ & integer_mask) >> fractional_bits);
}
- constexpr int64_t to_long() {
+ [[nodiscard]] constexpr int64_t to_long() {
round_up();
return static_cast<int64_t>((data_ & integer_mask) >> fractional_bits);
}
- constexpr int to_int_floor() const {
+ [[nodiscard]] constexpr int to_int_floor() const {
return static_cast<int>((data_ & integer_mask) >> fractional_bits);
}
- constexpr int64_t to_long_floor() const {
+ [[nodiscard]] constexpr int64_t to_long_floor() const {
return static_cast<int64_t>((data_ & integer_mask) >> fractional_bits);
}
- constexpr unsigned int to_uint_floor() const {
+ [[nodiscard]] constexpr unsigned int to_uint_floor() const {
return static_cast<unsigned int>((data_ & integer_mask) >> fractional_bits);
}
- constexpr float to_float() const {
+ [[nodiscard]] constexpr float to_float() const {
return static_cast<float>(data_) / FixedPoint::one;
}
- constexpr double to_double() const {
+ [[nodiscard]] constexpr double to_double() const {
return static_cast<double>(data_) / FixedPoint::one;
}
- constexpr base_type to_raw() const {
+ [[nodiscard]] constexpr base_type to_raw() const {
return data_;
}
@@ -449,7 +449,7 @@ public: // conversion to basic types
data_ &= fractional_mask;
}
- constexpr base_type get_frac() const {
+ [[nodiscard]] constexpr base_type get_frac() const {
return data_ & fractional_mask;
}